package com.gzly.query.redis.queryredis.controller;

import com.gzly.query.redis.queryredis.dao.CommonRedisDao;
import com.gzly.query.redis.queryredis.redis.QueryRedis;
import com.gzly.query.redis.queryredis.service.CacheService;
import com.gzly.query.redis.queryredis.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lzk
 * @date 2018/8/15
 */
@RestController
@RequestMapping("/cache")
public class CacheController {

    @Autowired
    public QueryRedis queryRedis;

    @RequestMapping(value = "get/{key}", method = RequestMethod.GET)
    public String getCache(@PathVariable("key") String key) {
        return queryRedis.get(key);
    }

    @RequestMapping(value = "add/{key}/{value}", method = RequestMethod.GET)
    public boolean add(@PathVariable("value") String value, @PathVariable("key") String key) {
        queryRedis.set(key, value);
        return true;
    }
}
